//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "MixedLinearCubicNaturalSpline.h"
using namespace Cephei::QL::Math::Interpolations;
#include <gen/QL/Math/Interpolations/MixedLinearCubicInterpolation.h>
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::CMixedLinearCubicNaturalSpline (boost::shared_ptr<QuantLib::MixedLinearCubicNaturalSpline>& childNative, Object^ owner) : CMixedLinearCubicInterpolation(CMixedLinearCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearCubicNaturalSpline = NULL;
#endif
	_ppMixedLinearCubicNaturalSpline = &childNative;
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearCubicNaturalSpline));
}
Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::CMixedLinearCubicNaturalSpline (QuantLib::MixedLinearCubicNaturalSpline& childNative, Object^ owner) : CMixedLinearCubicInterpolation(CMixedLinearCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearCubicNaturalSpline = NULL;
#endif
	_ppMixedLinearCubicNaturalSpline = new boost::shared_ptr<QuantLib::MixedLinearCubicNaturalSpline> (&childNative);
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearCubicNaturalSpline));
    _MixedLinearCubicNaturalSplineOwner = owner;
    _MixedLinearCubicInterpolationOwner = owner;
}

Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::CMixedLinearCubicNaturalSpline (CMixedLinearCubicNaturalSpline^ copy) : CMixedLinearCubicInterpolation(CMixedLinearCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearCubicNaturalSpline = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppMixedLinearCubicNaturalSpline = new boost::shared_ptr<QuantLib::MixedLinearCubicNaturalSpline> (copy->GetShared());
        _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearCubicNaturalSpline));
    }
}
Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::CMixedLinearCubicNaturalSpline (PLATFORM::Type^ t) : CMixedLinearCubicInterpolation(CMixedLinearCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearCubicNaturalSpline = NULL;
#endif
	if (!t->IsSubclassOf(CMixedLinearCubicNaturalSpline::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::CMixedLinearCubicNaturalSpline (QuantLib::Handle<QuantLib::MixedLinearCubicNaturalSpline>& childNative, Object^ owner)  : CMixedLinearCubicInterpolation(CMixedLinearCubicNaturalSpline::typeid)
{
	_phMixedLinearCubicNaturalSpline = &childNative;
	_ppMixedLinearCubicNaturalSpline = &static_cast<boost::shared_ptr<QuantLib::MixedLinearCubicNaturalSpline>>(childNative.currentLink());
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearCubicNaturalSpline));
    _MixedLinearCubicNaturalSplineOwner = owner;
}
Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::CMixedLinearCubicNaturalSpline (QuantLib::Handle<QuantLib::MixedLinearCubicNaturalSpline> childNative)  : CMixedLinearCubicInterpolation(CMixedLinearCubicNaturalSpline::typeid)
{
	_phMixedLinearCubicNaturalSpline = &childNative;
	_ppMixedLinearCubicNaturalSpline = &static_cast<boost::shared_ptr<QuantLib::MixedLinearCubicNaturalSpline>>(childNative.currentLink());
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearCubicNaturalSpline));
}
#endif
#ifdef STRUCT
Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::CMixedLinearCubicNaturalSpline (QuantLib::MixedLinearCubicNaturalSpline childNative)  : CMixedLinearCubicInterpolation(CMixedLinearCubicNaturalSpline::typeid)
{
#ifdef HANDLE
	_phMixedLinearCubicNaturalSpline = NULL;
#endif
	_ppMixedLinearCubicNaturalSpline = new boost::shared_ptr<QuantLib::MixedLinearCubicNaturalSpline> (new QuantLib::MixedLinearCubicNaturalSpline (childNative));
    _ppMixedLinearCubicInterpolation = new boost::shared_ptr<QuantLib::MixedLinearCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::MixedLinearCubicInterpolation> (*_ppMixedLinearCubicNaturalSpline));
}
#endif

Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::~CMixedLinearCubicNaturalSpline ()
{
    if (_ppMixedLinearCubicNaturalSpline != NULL)
    {
	    delete _ppMixedLinearCubicNaturalSpline;
        _ppMixedLinearCubicNaturalSpline = NULL;
    }
}
Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::!CMixedLinearCubicNaturalSpline ()
{
    if (_ppMixedLinearCubicNaturalSpline != NULL)
    {
	    delete _ppMixedLinearCubicNaturalSpline;
    }
}
QuantLib::MixedLinearCubicNaturalSpline& Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::GetReference ()
{
    if (_ppMixedLinearCubicNaturalSpline == NULL) throw REFNEW NativeNullException ();
	return **_ppMixedLinearCubicNaturalSpline;
}
boost::shared_ptr<QuantLib::MixedLinearCubicNaturalSpline>& Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::GetShared ()
{
    if (_ppMixedLinearCubicNaturalSpline == NULL) throw REFNEW NativeNullException ();
	return *_ppMixedLinearCubicNaturalSpline;
}
QuantLib::MixedLinearCubicNaturalSpline* Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::GetPointer ()
{
    if (_ppMixedLinearCubicNaturalSpline == NULL) throw REFNEW NativeNullException ();
	return &**_ppMixedLinearCubicNaturalSpline;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::MixedLinearCubicNaturalSpline>& Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::GetHandle ()
{
	if (_phMixedLinearCubicNaturalSpline == NULL)
	{
		_phMixedLinearCubicNaturalSpline = new Handle<QuantLib::MixedLinearCubicNaturalSpline> (*_ppMixedLinearCubicNaturalSpline);
	}
	return *_phMixedLinearCubicNaturalSpline;
}
#endif
bool Cephei::QL::Math::Interpolations::CMixedLinearCubicNaturalSpline::HasNative () 
{
	return (_ppMixedLinearCubicNaturalSpline != NULL);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

